class Solution
{
public:
    int findMin(vector<int> &nums)
    {
        int left = 0;
        int right = nums.size() - 1;
        while (left < right)
        {
            int mid = (left + right + 1) / 2;
            if (nums[mid] > nums[left])
            {
                left = mid;
            }
            else
            {
                right = mid - 1;
            }
        }
        return nums[(left + 1) % nums.size()];
    }
};